/*
 * GenericIterator.h - Grupo 5 - Prog. Avanzada 2011
 *
 *  Javier Dominguez - 4.901.161-6
 *  Marcelo Parada - 1.977.094-9
 *  Rodrigo Ruiz - 4.481.611-2
 *  Maximiliano Silvera - 4.106.938-6
 */

#ifndef GENERICITERATOR_H_H
#define GENERICITERATOR_H_H

#include "../collections/IIterator.h"

template<class Type>
class GenericIterator
{
private:
	IIterator *iter;

public:
	GenericIterator(IIterator *iter);

	virtual void next();

	virtual Type current();

	virtual bool hasCurrent();

	virtual ~GenericIterator();
};

template<typename Type>
GenericIterator<Type>::GenericIterator(IIterator *iter)
{
	this->iter = iter;
}

template<typename Type>
void GenericIterator<Type>::next()
{
	iter->next();
}

template<typename Type>
Type GenericIterator<Type>::current()
{
	return (Type) iter->current();
}

template<typename Type>
bool GenericIterator<Type>::hasCurrent()
{
	return iter->hasCurrent();
}

template<typename Type>
GenericIterator<Type>::~GenericIterator()
{
	iter->~IIterator();

	delete iter;
}

#endif /* GENERICITERATOR_H_H */
